home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Freeware
/
Read It Later 0.9924
/
read_it_later-0.9924-fx.xpi
/
chrome
/
isreaditlater.jar
/
content
/
ISRILprefs.js
< prev
next >
Wrap
Text File
|
2008-11-02
|
5KB
|
143 lines
function ISRILprefs()
{
this.sPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("isreaditlater.");
}
ISRILprefs.prototype = {
setPrefIfNot : function(p, v) {
if(!ISRILprefs.prefIsSet(p)) {
ISRILprefs.setPref(p, v);
}
},
prefIsSet : function(p) {
return ( (ISRILprefs.sPrefs.prefHasUserValue(p)) ? (true) : (false) );
},
setPref : function(p, v) {
return ISRILprefs.sPrefs.setCharPref(p, v);
},
renamePref : function(op, np) {
ISRILprefs.setPref(np, ISRILprefs.pref(op));
ISRILprefs.delPref(op);
},
delPref : function(p) {
if (ISRILprefs.prefIsSet(p)) {
return ISRILprefs.sPrefs.clearUserPref(p);
}
},
append : function(p, v) {
return ISRILprefs.sPrefs.setCharPref(p, ISRILprefs.pref(p) + v);
},
pref : function(p) {
return ISRILprefs.sPrefs.getCharPref(p);
},
prefB : function(p) {
return ( (ISRILprefs.pref(p)=='true') ? (true):(false) );
},
loadDefaults : function() {
//Installation
ISRILprefs.setPrefIfNot("installed", (ISRILprefs.prefIsSet('version')) ? true : false );
ISRILprefs.setPrefIfNot("sites", ',6,7,47,19,26,44');
ISRILprefs.setPrefIfNot("version", ((ISRIL.v > '0.97')?(ISRIL.v):('')) ); //added in 0.98, this shows changelog to those upgrading from version previous to this
ISRILprefs.setPrefIfNot("added_to_toolbar", false);
ISRILprefs.setPrefIfNot("install-version", '0');
//Reading/Saving
ISRILprefs.setPrefIfNot("read", 'next');
ISRILprefs.setPrefIfNot("mark", 'null');
ISRILprefs.setPrefIfNot("open", 'current');
ISRILprefs.setPrefIfNot("auto-tags", '');
ISRILprefs.setPrefIfNot("autoMark", 0);
ISRILprefs.setPrefIfNot("autoOffline", false);
ISRILprefs.setPrefIfNot("auto-close-tab", false);
//Appearance
ISRILprefs.setPrefIfNot("context-menu", true);
ISRILprefs.setPrefIfNot("list-view", 'normal');
ISRILprefs.setPrefIfNot("list-place", 'btn');
ISRILprefs.setPrefIfNot("list-type", 'pages');
ISRILprefs.setPrefIfNot("list-page", 9);
ISRILprefs.setPrefIfNot("default-sort", '11');
ISRILprefs.setPrefIfNot("ask-aiderss", true);
ISRILprefs.setPrefIfNot("clicktosaveinbar", true);
ISRILprefs.setPrefIfNot("show-count", false);
ISRILprefs.setPrefIfNot("link-checks", 'hide');
ISRILprefs.setPrefIfNot("force-styles", true);
//Keystrokes
ISRILprefs.setPrefIfNot("hotkey_toggle", 'alt||W');
ISRILprefs.setPrefIfNot("hotkey_push", 'alt||P');
ISRILprefs.setPrefIfNot("hotkey_open_list", 'alt||Q');
ISRILprefs.setPrefIfNot("hotkey_click_mode", 'alt||M');
//Syncing
ISRILprefs.setPrefIfNot("feed", false);
ISRILprefs.setPrefIfNot("feed-id-default", '0');
ISRILprefs.setPrefIfNot("feed-id-alt", '0');
ISRILprefs.setPrefIfNot("feed-which", 'default');
ISRILprefs.setPrefIfNot("sync", false);
ISRILprefs.setPrefIfNot("sync-default", '0');
ISRILprefs.setPrefIfNot("sync-alt", '0');
ISRILprefs.setPrefIfNot("feed-private", false);
ISRILprefs.setPrefIfNot("super-security-mode", false);
ISRILprefs.setPrefIfNot("feed-email-saved", false);
ISRILprefs.setPrefIfNot("last_get", '0');
ISRILprefs.setPrefIfNot("shutdown-send", true);
ISRILprefs.setPrefIfNot("shutdown-prompt", true);
ISRILprefs.setPrefIfNot("online-access-prompt",true);
//Google Reader
ISRILprefs.setPrefIfNot("integrate-gr", true);
//Prompt Windows
ISRILprefs.setPrefIfNot("prompt_clear_offline",true);
//Debug
ISRILprefs.setPrefIfNot("debug", false);
// -- Upgrading prefs from old versions -- //
try {
//keystroke format update - 0.98
if (ISRILprefs.pref('hotkey_toggle').length <= 1) {
ISRILprefs.setPref('install-version', '0.97');
ISRILprefs.setPref('hotkey_toggle', 'alt||'+ISRILprefs.pref('hotkey_toggle'));
ISRILprefs.setPref('hotkey_push', 'alt||'+ISRILprefs.pref('hotkey_push'));
ISRILprefs.setPref('hotkey_open_list', 'alt||'+ISRILprefs.pref('hotkey_open_list'));
ISRILprefs.setPref('hotkey_click_mode', 'alt||'+ISRILprefs.pref('hotkey_click_mode'));
}
//changes - 0.99
if (ISRILprefs.sPrefs.prefHasUserValue('last_usync')) {
ISRILprefs.setPref('install-version', '0.98');
ISRILprefs.renamePref('last_usync', 'last_get');
ISRILprefs.delPref("temp-sync-inserts");
ISRILprefs.delPref("temp-sync-updates");
ISRILprefs.delPref("temp-sync-tagUpdates");
ISRILglobals.flagRenameFiles = true; //rename offline files from GUID to id when offline starts up
}
} catch(e) {
//nothing critical here, just cleaning up, so fail silently if there is a problem
}
},
}
var ISRILprefs = new ISRILprefs();